import { Component, OnInit } from '@angular/core';
import { Params, ActivatedRoute } from '@angular/router';
import { AuthService } from 'src/app/services/auth.service';
import * as constants from '../../../providers/Constants'
import { ToastService } from './../../../providers/toast/toast.service'
import { NavController } from '@ionic/angular';
import { Utils } from 'src/app/providers/Utils';

@Component({
  selector: 'app-complain-list',
  templateUrl: './complain-list.page.html',
  styleUrls: ['./complain-list.page.scss'],
})
export class ComplainListPage implements OnInit {
  faqArray:any=[];
  constructor( private nav: NavController, private auth: AuthService, private toast: ToastService) {
 
  }
  ionViewDidEnter() {
    this.auth.getUserQuestion({
      param:'2'//1查常见问题 2查投诉
    }).subscribe(res => {
      // 保存成功返沪上一页，否则弹出提示框
      if (res.retCode == '000000') {
        // for (let index = 0; index < res.array.length; index++) {
        //   res.array[index].select=false;
        // }
        this.faqArray=res.array;
      }  else if (constants.errCode[res.retCode]) {
        if (constants.errCode[res.retCode] != '0') {
          this.toast.show(constants.errCode[res.retCode]);
        }
      } else if (res.retMsg) {
        this.toast.show(res.retMsg);
      } else {
        this.toast.show("exception service routine");
      }
    });
  }


  ngOnInit() {
   
  }

  formatData(str){
    return Utils.strFormatData1(str);
  }
}
